﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;

/// <summary>
/// Summary description for IUsers
/// </summary>
/// <author>Dang Quoc Dat</author>
public interface IUsers
{
    /// <summary>
    /// Get all users 
    /// </summary>
    /// <returns>Return object DataTable stores list users</returns>
    List<Users> GetAllUsers();

    /// <summary>
    /// Get all Users by role
    /// </summary>
    /// <param name="idRole">Role of User</param>
    /// <returns>Return list Users</returns>
    List<Users> GetUsersByRole(Roles role);

    /// <summary>
    /// Get User by Username
    /// </summary>
    /// <param name="username">Username of user</param>
    /// <returns>Return object DataTable stores list users</returns>
    Users GetUserByUsername(string username);

    /// <summary>
    /// Create User
    /// </summary>
    /// <param name="username">Username of User</param>
    /// <param name="password">Password of User</param>
    /// <param name="email">Email of User</param>
    /// <returns>Return result was created. If created then return 1, else return 0</returns>
    bool CreateUser(string username, string password, string email);

    /// <summary>
    /// Update User
    /// </summary>
    /// <param name="user">User need to update</param>
    /// <returns>Return result was updated. If success then return 1, else return 0</returns>
    bool UpdateUser(Users user);

    /// <summary>
    /// Check login of User
    /// </summary>
    /// <param name="user"></param>
    /// <returns></returns>
    Users CheckLogin(string username, string password);

    /// <summary>
    /// Convert object DataRow to User
    /// </summary>
    /// <param name="dr">Object DataRow from DataTable</param>
    /// <returns>Return User was converted</returns>
    Users ConvertObjectDataRowToUser(DataRow dr);
}